// WordFileHelper.kt
package com.example.sunchaodong

import android.content.Context
import java.io.File

class WordFileHelper(private val context: Context) {

    private val fileName = "words.txt"

    fun saveWordsToFile(words: List<String>) {
        val file = File(context.filesDir, fileName)
        file.writeText(words.joinToString("\n"))
    }

    fun readWordsFromFile(): List<String> {
        val file = File(context.filesDir, fileName)
        if (!file.exists()) {
            return emptyList()
        }
        return file.readLines()
    }
}